<template >
  <div class="Mycollect">
    <Back title="我的收藏" :sticky="true">
     
    </Back>
    <div class="my-bg"></div>
    <div class="my-box">
    <div class="mycollect-list">
      <div class="pro-item-box" v-for="(item, index) in productData" :key="index" @click="goDetail(item.pid)">
        <ProItem :product="item" />
      </div>
    </div>
      
    </div>
  </div>
</template>

<script>
import Back from "../components/Back.vue";

import ProItem from "../components/ProItem.vue";
export default {
  name: "Mycollect",
  created() {
    this.getCollectData();
  },
  components: {
    ProItem,
    Back 
  },
  data() {
    return {
        
        value :'',
       //商品数据
        productData: []
    };
  },
  methods: {
    goDetail(pid){
     this.$router.push({name:'Detail', params:{pid}})
    },
    //获取收藏商品数据
    getCollectData() {
      let params = {
        tokenString: sessionStorage.getItem('token')
      };
      this.axios({
        method: "GET",
        url: "/findAllLike",
        params
      })
        .then((res) => {
           if (res.data.code === 2000) {
            this.productData = res.data.result;
          }

                  })
        .catch((err) => {
                  });
    },
  },
};
</script>

<style lang="less" scoped>
.mycollect-list{
  width: 100%;
 clear: both;
}
 .pro-item-box{
    float: left;
    width: 30%;
    margin: 45px 5px;
    padding: 0;
  }
  /deep/ .van-search{
    height: 40px;
  }
</style>

